function(add_sd_object _INSTALL_HEADER_FILES)
	set(OBJECT_NAME sd)
	set(INSTALL_PATH include/sd)
	foreach (ARG IN LISTS ARGN)
		set(OBJECT_NAME ${OBJECT_NAME}__${ARG})
		set(INSTALL_PATH ${INSTALL_PATH}/${ARG})
	endforeach ()
	aux_source_directory(. ${OBJECT_NAME}_SOURCE)
	add_library(${OBJECT_NAME}_OBJECT OBJECT
			${${OBJECT_NAME}_SOURCE})
	target_include_directories(${OBJECT_NAME}_OBJECT PUBLIC
			${LIB_DWARF_INCLUDE_DIR})
	if (_INSTALL_HEADER_FILES)
		file(GLOB HEADER_FILES *.h)
		install(FILES ${HEADER_FILES} DESTINATION ${INSTALL_PATH})
	endif ()
endfunction()

add_sd_object(TRUE)

add_library(sd_SHARED SHARED
		$<TARGET_OBJECTS:dwarf_OBJECT>
		$<TARGET_OBJECTS:sd_OBJECT>
		$<TARGET_OBJECTS:sd__implementation_OBJECT>
		$<TARGET_OBJECTS:unwind_OBJECT>)
set_target_properties(sd_SHARED PROPERTIES OUTPUT_NAME SelfDebug)
install(TARGETS sd_SHARED DESTINATION lib)

add_subdirectory(implementation)
